<html lang="zh"><head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>修改不良记录</title>
    <link rel="shortcut icon" href="../../../static/favicon.ico">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/font-awesome.min.css" rel="stylesheet">
    <!-- bootstrap-table 表格插件样式 -->
    <link href="/ajax/libs/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css" rel="stylesheet">
    <link href="/feitian/css/ry-ui.css" rel="stylesheet">


    <link href="/ajax/libs/datapicker/bootstrap-datetimepicker.min.css" rel="stylesheet">

    <link rel="stylesheet" href="/ajax/libs/layer/theme/default/layer.css?v=3.1.1" id="layuicss-layer"><link rel="stylesheet" href="http://localhost:9421/ajax/libs/layer/theme/moon/style.css" id="layuicss-thememoonstylecss"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-leave-update" novalidate="novalidate">
        <div class="form-group">
            <label class="col-sm-3 control-label">用户id：</label>
            <div class="col-sm-8">
                <input name="userId" class="form-control" type="text" required="" aria-required="true">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">记录类型</label>
            <div class="col-sm-8">
                <div class="col-sm-8">
                    <select name="type" class="form-control m-b">
                        <option value="1">迟到</option>
                        <option value="2">旷工</option>
                        <option value="3">恶意打卡</option>
                    </select>
                </div>
            </div>
            <div class="layui-layer-btn layui-layer-btn-">
                <br><a class="layui-layer-btn0" id="save">确定</a>
                <a class="layui-layer-btn1" id="back">关闭</a>
            </div>
        </div>
    </form>

    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/ajax/libs//datapicker/bootstrap-datetimepicker.min.js"></script>
    <script>
        $(function(){
            init();
            update();
        })
        var id=location.search;
        function init(){
            $.ajax({
                url:"/system/badness/getbadnessbyid"+id,
                dataType:"json",
                type:"POST",
                async:false,
                success:function(data){
                    $("#form-leave-update [name=userId]").val(data.userId);
                    $("#form-leave-update [name=type]").val(data.type);
                    $("#form-leave-update [name=createtime]").val(data.createtime);
                }
            })
        }
        function update(){
            $("#save").click(function(){
                $.ajax({
                    url:"/system/badness/updatebadness"+id,
                    type:"POST",
                    data:$("#form-leave-update").serialize(),
                    success:function(data){
                        if (data>0){
                            alert("修改成功！")
                            location.href="/system/badness"
                        }
                    }
                })
            })
            $("#back").click(function (){
                location.href="/system/badness"
            })
        }

    </script>
    <script type="text/javascript">
        $("input[name='createtime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

    </script>

</div>

</body>
</html>